package study.demo02;

import java.lang.reflect.Proxy;

public class UserServiceProxy implements UserService{

    private UserServiceImpl userService = new UserServiceImpl();

    public void setUserService(UserServiceImpl userService) {
        this.userService = userService;

    }

    @Override
    public void add() {
        log("add");
        userService.add();
    }

    @Override
    public void delete() {
        log("delete");
        userService.delete();
    }

    @Override
    public void update() {
        log("update");
        userService.update();
    }

    @Override
    public void search() {
        log("search");
        userService.search();
    }

    public void log(String msg){
        System.out.println("使用了" + msg + "方法");
    }
}
